package org.example.javaee.controller;

import org.example.javaee.dao.StudentDao;
import org.example.javaee.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/Student")
public class StudentController {
    @Autowired
    StudentDao studentDao;

    @RequestMapping("list")
    public String list(Model model) {
        List<Student> students=studentDao.selectAll();
        model.addAttribute("students",students);
        return "Body";
    }
}
